﻿using System.Collections.Generic;
using Microsoft.Data.Schema.ScriptDom.Sql;

namespace Neznayka
{
    internal class UninitialisedVariableDeclarationVisitor : TSqlConcreteFragmentVisitor
    {
        private List<Literal> _variableDeclarations;

        #region ctor
        public UninitialisedVariableDeclarationVisitor()
        {
            _variableDeclarations = new List<Literal>();
        }
        #endregion

        #region properties
        public List<Literal> VariableDeclarations
        {
            get { return _variableDeclarations; }
        }
        #endregion

        #region overrides
        public override void ExplicitVisit(DeclareVariableElement node)
        {
            if (node.InitialValue == null)
            {
                _variableDeclarations.Add(node.VariableName);
            }
        }
        #endregion

    }


}